package com.personal.Visualplan.imp;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.personal.Visualplan.entity.User;
import com.personal.Visualplan.repository.UserRepository;
import com.personal.Visualplan.service.UserService;

/**
 * 
 * @author "ChenJing"
 * @version 1.0
 * @date 2020年3月2日 下午10:19:35
 * @description 该类为UserService接口的实现
 *
 */
@Service
public class UserImp implements UserService {

	@Resource
	private UserRepository userRepository;

	@Override
	public User userRegister(User user) {
		User result = userRepository.findByUserId(user.getUserId());
		if (result != null) {
			return result;
		} else {
			return userRepository.save(user);
		}
	}

	@Override
	public User findByUserId(String userId) {
		return userRepository.findByUserId(userId);
	}

}
